package main

import "fmt"

//课后练习 1.1
//编写一个小程序：
//给定一个字符串数组
//["I","am","stupid","and","weak"]
//用 for 循环遍历该数组并修改为
//["I","am","smart","and","strong"]

func main() {
	strArr := []string{"I", "am", "stupid", "and", "weak"}
	fmt.Println(strArr)
	for i, str := range strArr {
		if str == "stupid" {
			strArr[i] = "smart"
			continue
		}
		if str == "weak" {
			strArr[i] = "strong"
			continue
		}
	}
	fmt.Println(strArr)

}

/*
打印结果
[I am stupid and weak]
[I am smart and strong]

*/
